home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 3 / Amiga Format CD03 (1996-07-04)(Future Publishing)(GB)(Track 1 of 6)[!][issue 1996-08].iso / pd / utilities / tinymeter / source / tinymeter_main / launchclass.c < prev    next >
C/C++ Source or Header  |  1996-05-20  |  16KB  |  549 lines

  1. #include <exec/types.h>
  2. #include <exec/memory.h>
  3. #include <dos/dos.h>
  4. #include <dos/dosextens.h>
  5. #include <intuition/intuition.h>
  6. #include <intuition/gadgetclass.h>
  7. #include <intuition/intuitionbase.h>
  8. #include <intuition/classusr.h>
  9. #include <intuition/imageclass.h>
  10. #include <intuition/gadgetclass.h>
  11. #include <intuition/cghooks.h>
  12. #include <intuition/icclass.h>
  13. #include <intuition/classes.h>
  14. #include <intuition/sghooks.h>
  15. #include <intuition/screens.h>
  16. #include <graphics/gfxbase.h>
  17. #include <graphics/text.h>
  18. #include <graphics/gfxmacros.h>
  19. #include <utility/tagitem.h>
  20. #include <utility/hooks.h>
  21. #include <datatypes/datatypesclass.h>
  22. #include <datatypes/datatypes.h>
  23. #include <datatypes/pictureclass.h>
  24. #include <string.h>
  25. #include "launchclass.h"
  26. #include "tinymeter.h"
  27.  
  28. #define err_nolis       7
  29.  
  30. #define col_entry       1
  31. #define col_hbright     2
  32. #define col_hdark       3
  33. #define col_cursor      4
  34.  
  35. struct LauncherData
  36. {
  37.     struct  Screen *scr;
  38.     char    *txtlbl;
  39.     char    *file;
  40.     struct  LAU_Color Colors[LAU_UsedColors+1];
  41.     BOOL    Style3D;
  42.     BOOL    StyleBorder;
  43.     BOOL    StyleBackground;
  44.     BOOL    StyleShadowLabel;
  45.     BOOL    StyleTransparent;
  46.     struct  TextFont *textFont;
  47.     ULONG   Pens[LAU_UsedColors];
  48.     BOOL    PorC[LAU_UsedColors];
  49.     BOOL    InitNotDone;
  50.     UWORD   text_y;
  51.     UWORD   indent;
  52.     struct  lau_entry *list;
  53.     ULONG   x_pos;
  54.     ULONG   down;
  55.     ULONG   diswhat;
  56.     Object  *img;
  57. };
  58.  
  59. ULONG dispatchLauncherGadget(Class *cl,Object *o, Msg msg);
  60. ULONG newLauncher(Class *cl,struct Gadget *g,struct gpRender *msg);
  61. ULONG renderLauncher(Class *cl,struct Gadget *g, struct gpRender *msg);
  62. ULONG getLauncher(Class *cl,struct Gadget *g,struct gpRender *msg);
  63. setLauncher(Class *cl,struct Gadget *g,struct gpRender *msg);
  64. extern ULONG HookEntry();
  65.  
  66. __geta4 ULONG dispatchLauncherGadget(Class *cl,Object *o, Msg msg)
  67. {
  68.     switch( msg->MethodID )
  69.     {
  70.     case    OM_NEW:
  71.         if(o = (Object *)DoSuperMethodA(cl, o, msg) )
  72.         {
  73.             newLauncher(cl,(struct Gadget *)o,(struct gpRender *)msg);
  74.         }
  75.         return((ULONG)o);
  76.     case    GM_RENDER:
  77.         return(renderLauncher(cl,(struct Gadget *)o,(struct gpRender *)msg));
  78.     case    OM_SET:
  79.         setLauncher((Class *)cl,(struct Gadget *)o,(struct gpRender *)msg);
  80.         return(DoSuperMethodA(cl,o,msg));
  81.     case    OM_GET:
  82.         return((ULONG)getLauncher(cl,(struct Gadget *)o,(struct gpRender *)msg));
  83.     case    GM_HITTEST:
  84.         return(GMR_GADGETHIT);
  85.     case    GM_GOACTIVE:
  86.         if( ((struct gpInput *)msg)->gpi_IEvent )
  87.         {
  88.             struct LauncherData *inst=INST_DATA(cl,o);
  89.             ((struct Gadget *)o)->Flags |= GFLG_SELECTED;
  90.             if(inst->diswhat!=typ_iconlauncher) renderLauncher(cl,(struct Gadget *)o, (struct gpRender *)msg);
  91.             return(GMR_MEACTIVE);
  92.         }
  93.         return(GMR_NOREUSE);
  94.     case    GM_GOINACTIVE:
  95.         {
  96.             struct LauncherData *inst=INST_DATA(cl,o);
  97.             ((struct Gadget *)o)->Flags &= ~GFLG_SELECTED;
  98.             if(inst->diswhat!=typ_iconlauncher) renderLauncher(cl,(struct Gadget *) o, (struct gpRender *)msg);
  99.         }
  100.         return(NULL);
  101.     case    GM_HANDLEINPUT:
  102.         {
  103.             struct Gadget *g = (struct Gadget *)o;
  104.             struct gpInput *gpi = (struct gpInput *)msg;
  105.             struct InputEvent *ie = gpi->gpi_IEvent;
  106.             ULONG  retval=GMR_MEACTIVE;
  107.  
  108.             if( ie->ie_Class==IECLASS_RAWMOUSE)
  109.             {
  110.             switch( ie->ie_Code )
  111.             {
  112.                 case SELECTUP:
  113.                     if( (gpi->gpi_Mouse.X < g->LeftEdge ) ||
  114.                     (gpi->gpi_Mouse.X > g->LeftEdge + g->Width) ||
  115.                     (gpi->gpi_Mouse.Y < g->TopEdge ) ||
  116.                     (gpi->gpi_Mouse.Y > g->TopEdge  + g->Height) )
  117.                     {
  118.                         retval= GMR_NOREUSE | GMR_VERIFY;
  119.                     }
  120.                     else    retval= GMR_NOREUSE ;
  121.                     break;
  122.                 case MENUUP:
  123.                 case MENUDOWN:
  124.                     retval=GMR_NOREUSE;
  125.                     break;
  126.                 default:
  127.                     retval=GMR_MEACTIVE;
  128.                     break;
  129.             }
  130.             }
  131.             return(retval);
  132.         }
  133.     case    OM_DISPOSE:
  134.         {
  135.             struct lau_entry *entry;
  136.             struct LauncherData *inst=INST_DATA(cl,o);
  137.             int w;
  138.             if(inst->diswhat!=typ_iconlauncher) for(w=0;w<LAU_UsedColors;w++)FreePenNew(inst->scr,&inst->Colors[w],w,inst->Pens);
  139.             if(inst->txtlbl)pFreeVec(inst->txtlbl);
  140.             DisposeDTObject(inst->img);
  141.             while(inst->list)
  142.             {
  143.             entry = inst->list->next;
  144.             DisposeDTObject(inst->list->img);
  145.             pFreeVec  (inst->list->lau_lbl);
  146.             pFreeVec  (inst->list->lau_cmd);
  147.             pFreeVec  (inst->list->lau_pth);
  148.             pFreeVec  (inst->list->lau_out);
  149.             pFreeVec  (inst->list);
  150.             inst->list=entry;
  151.             }
  152.         }
  153.     default:
  154.         return(DoSuperMethodA(cl,o,msg));
  155.     }
  156. }
  157.  
  158. Class *initLauncherGadgetClass(void)
  159. {
  160.     Class *cl;
  161.     if( cl = (Class *)MakeClass( NULL, "gadgetclass", NULL, sizeof(struct LauncherData), 0) )
  162.     {
  163.     cl->cl_Dispatcher.h_Entry    = HookEntry;
  164.     cl->cl_Dispatcher.h_SubEntry = (HOOKFUNC)dispatchLauncherGadget;
  165.     }
  166.     return(cl);
  167. }
  168.  
  169. setLauncher(Class *cl,struct Gadget *g,struct gpRender *msg)
  170. {
  171.     struct LauncherData    *inst=INST_DATA(cl,g);
  172.     if ( FindTagItem(GA_Width,  ((struct opSet *)msg)->ops_AttrList) ||
  173.      FindTagItem(GA_Height, ((struct opSet *)msg)->ops_AttrList) ||
  174.      FindTagItem(GA_Top,    ((struct opSet *)msg)->ops_AttrList) ||
  175.      FindTagItem(GA_Left,   ((struct opSet *)msg)->ops_AttrList) )
  176.     {
  177.     inst->InitNotDone=TRUE;
  178.     }
  179. }
  180.  
  181. ULONG getLauncher(Class *cl,struct Gadget *g,struct gpRender *msg)
  182. {
  183.     struct LauncherData *inst=INST_DATA(cl,g);
  184.     switch (((struct opGet *)msg)->opg_AttrID)
  185.     {
  186.     case    LAU_Down:
  187.         *(((struct opGet *)msg)->opg_Storage)=(ULONG)inst->down;
  188.         break;
  189.     case    LAU_List:
  190.         *(((struct opGet *)msg)->opg_Storage)=(ULONG)inst->list;
  191.         break;
  192.     case    LAU_ColLabel:
  193.         *(((struct opGet *)msg)->opg_Storage)=(ULONG)inst->Pens[0];
  194.         break;
  195.     case    LAU_ColEntry:
  196.         *(((struct opGet *)msg)->opg_Storage)=(ULONG)inst->Pens[1];
  197.         break;
  198.     case    LAU_ColHalfBright:
  199.         *(((struct opGet *)msg)->opg_Storage)=(ULONG)inst->Pens[2];
  200.         break;
  201.     case    LAU_ColHalfShadow:
  202.         *(((struct opGet *)msg)->opg_Storage)=(ULONG)inst->Pens[3];
  203.         break;
  204.     case    LAU_ColCursor:
  205.         *(((struct opGet *)msg)->opg_Storage)=(ULONG)inst->Pens[4];
  206.         break;
  207.     case    LAU_ColBrightEdg:
  208.         *(((struct opGet *)msg)->opg_Storage)=(ULONG)inst->Pens[5];
  209.         break;
  210.     case    LAU_ColDarkEdg:
  211.         *(((struct opGet *)msg)->opg_Storage)=(ULONG)inst->Pens[6];
  212.         break;
  213.     case    LAU_ColBackground:
  214.         *(((struct opGet *)msg)->opg_Storage)=(ULONG)inst->Pens[7];
  215.         break;
  216.     case    LAU_Type:
  217.         *(((struct opGet *)msg)->opg_Storage)=(ULONG)inst->diswhat;
  218.         break;
  219.     case    LAU_Transparent:
  220.         *(((struct opGet *)msg)->opg_Storage)=(ULONG)inst->StyleTransparent;
  221.         break;
  222.     case    LAU_XPos:
  223.         *(((struct opGet *)msg)->opg_Storage)=(ULONG)inst->x_pos;
  224.         break;
  225.     case    LAU_ImgHeight:
  226.         {
  227.             struct BitMapHeader *bmhd;
  228.             if(inst->img)
  229.             {
  230.             GetDTAttrs(inst->img,PDTA_BitMapHeader,&bmhd,TAG_DONE);
  231.             *(((struct opGet *)msg)->opg_Storage)=(ULONG)bmhd->bmh_Height;
  232.             }
  233.             else *(((struct opGet *)msg)->opg_Storage)=0L;
  234.         }
  235.         break;
  236.     default:
  237.         *(((struct opGet *)msg)->opg_Storage)=0;
  238.         break;
  239.     }
  240.     return((ULONG)TRUE);
  241. }
  242.  
  243.  
  244. BOOL freeLauncherGadgetClass( Class *cl )
  245. {
  246.     return(FreeClass(cl));
  247. }
  248.  
  249. CleanString(char *buffer)
  250. {
  251.     int i;
  252.      if(!(i=my_strlen(buffer))) buffer[0]=0x00;
  253.     else if(buffer[i-1]==0x0a) buffer[i-1]=0x00;
  254. }
  255.  
  256. StripSpaces(char *src, char *dest)
  257. {
  258.     int i,j;
  259.     BOOL foo=FALSE;
  260.     if(src[my_strlen(src)-1]==0x20)
  261.     {
  262.     for(i=my_strlen(src)-1;i>-1;i--) if(src[i]==0x20) src[i]=0x0; else break;
  263.     }
  264.     for(i=0,j=0;i<my_strlen(src);i++) if((src[i]!=0x20)||(foo==TRUE))
  265.     {
  266.     if(src[i]!=0x0a) dest[j++]=src[i];
  267.     foo=TRUE;
  268.     }
  269.     dest[j]=0;
  270. }
  271.  
  272. CopyString(char *src, char **dest, struct LauncherData *inst)
  273. {
  274.     if(my_strlen(src))
  275.     {
  276.     *dest=(char *)pAllocVec(my_strlen(src)+4L);
  277.     StripSpaces(src,*dest);
  278.     }
  279.     else *dest=(char *)pAllocVec(4L);
  280. }
  281.  
  282. ULONG newLauncher(Class *cl,struct Gadget *g,struct gpRender *msg)
  283. {
  284.     struct   TagItem *ti;
  285.     struct   LauncherData *inst=INST_DATA(cl,g);
  286.     BPTR     file;
  287.  
  288.     ti      = ((struct opSet *)msg)->ops_AttrList;
  289.     if(inst->scr = (struct Screen *)GetTagData(LAU_Screen, 0, ti))
  290.     {
  291.     if(inst->textFont = (struct TextFont *)GetTagData(LAU_TextFont,OpenTopaz(),ti))
  292.     {
  293.         char *dummy;
  294.         if(dummy=(char *)pAllocVec(256L))
  295.         {
  296.         int     i;
  297.         UWORD   def_pens[]={ 2, 2, 1, 3, 1, 2, 1, 0 };
  298.         ULONG   lau_tags[]={LAU_ColLabel,LAU_ColEntry,LAU_ColHalfBright,LAU_ColHalfShadow,LAU_ColCursor,LAU_ColBrightEdg,LAU_ColDarkEdg,LAU_ColBackground};
  299.  
  300.         inst->file              = (char *)GetTagData(LAU_File, " ", ti);
  301.         inst->Style3D           = GetTagData(LAU_3D,  TRUE, ti);
  302.         inst->StyleBorder       = GetTagData(LAU_Border, TRUE, ti);
  303.         inst->StyleBackground   = GetTagData(LAU_Background, FALSE, ti);
  304.         inst->StyleShadowLabel  = GetTagData(LAU_ShadowLabel, FALSE, ti);
  305.         inst->StyleTransparent  = GetTagData(LAU_Transparent, FALSE, ti);
  306.         inst->down              = GetTagData(LAU_Down, FALSE, ti);
  307.         inst->indent            = GetTagData(LAU_Indent, lind_realcenter, ti);
  308.         inst->diswhat           = GetTagData(LAU_Type, 0, ti);
  309.         for(i=0;i<LAU_UsedColors;i++) CopyMem(GetTagData(lau_tags[i],GetGaugePen(def_pens[i]), ti), &inst->Colors[i], sizeof(struct LAU_Color));
  310.         inst->InitNotDone=TRUE;
  311.         if(file=Open(inst->file,MODE_OLDFILE))
  312.         {
  313.             if(FGets(file,dummy,255))
  314.             {
  315.             if(*((ULONG *)dummy)==0x544D4C49)
  316.             {
  317.                 if(FGets(file,dummy,255))
  318.                 {
  319.                 CopyString(dummy,&inst->txtlbl,inst);
  320.                 if(FGets(file,dummy,255))
  321.                 {
  322.                     CleanString(dummy);
  323.                     if(dummy[0])inst->img=(Object *)LoadImage(dummy,inst->scr);
  324.                     else        inst->img=0L;
  325.                     if(inst->list=(struct lau_entry *)pAllocVec(sizeof(struct lau_entry)))
  326.                     {
  327.                     struct lau_entry *oldentry,*actentry=inst->list;
  328.                     while(FGets(file,dummy,32))
  329.                     {
  330.                         CopyString(dummy,&actentry->lau_lbl,inst);
  331.                         FGets(file,dummy,255);
  332.                         CopyString(dummy,&actentry->lau_cmd,inst);
  333.                         FGets(file,dummy,8);
  334.                         CleanString(dummy);
  335.                         actentry->lau_type=dummy[0]-0x30;
  336.                         FGets(file,dummy,255);
  337.                         CopyString(dummy,&actentry->lau_pth,inst);
  338.                         FGets(file,dummy,255);
  339.                         CopyString(dummy,&actentry->lau_out,inst);
  340.                         FGets(file,dummy,16);
  341.                         CleanString(dummy);
  342.                         {
  343.                         LONG i,j=1,out=0L;
  344.                         for(i=my_strlen(dummy)-1;i>-1;i--)
  345.                         {
  346.                             if((dummy[i]>0x29)&&(dummy[i]<0x3A))
  347.                             {
  348.                             out+=((dummy[i]-0x30)*j);
  349.                             j*=10;
  350.                             }
  351.                         }
  352.                         actentry->lau_stack=out;
  353.                         }
  354.                         FGets(file,dummy,255);
  355.                         CleanString(dummy);
  356.                         if(dummy[0]) actentry->img=(Object *)LoadImage(dummy,inst->scr);
  357.                         else         actentry->img=0L;
  358.  
  359.                         oldentry=actentry;
  360.                         actentry=(struct lau_entry *)pAllocVec(sizeof(struct lau_entry));
  361.                         oldentry->next=actentry;
  362.                     }
  363.                     pFreeVec(actentry);
  364.                     oldentry->next=NULL;
  365.                     }
  366.                     else
  367.                     {
  368.                     pFreeVec(inst->list);
  369.                     inst->list=NULL;
  370.                     }
  371.                 }
  372.                 }
  373.                 else show(err_nolis);
  374.             }
  375.             else show(err_nolis);
  376.             }
  377.             else show(err_nolis);
  378.             Close(file);
  379.         }
  380.         pFreeVec(dummy);
  381.         return((ULONG)g);
  382.         }
  383.     }
  384.     }
  385.     return(0L);
  386. }
  387.  
  388. ULONG renderLauncher(Class *cl,struct Gadget *g,struct gpRender *msg)
  389. {
  390.     struct RastPort         *rp;
  391.     struct BitMapHeader     *bmhd;
  392.     struct LauncherData     *inst=INST_DATA(cl,(Object *)g);
  393.  
  394.     if(msg->gpr_GInfo)
  395.     if(rp = ( msg->MethodID == GM_RENDER ) ? msg->gpr_RPort : (struct RastPort *) ObtainGIRPort(msg->gpr_GInfo) )
  396.     {
  397.     switch (inst->diswhat)
  398.     {
  399.         case    typ_simplelauncher:
  400.             {
  401.             UWORD text_x,w,t_length;
  402.             if(inst->InitNotDone) for(w=0;w<LAU_UsedColors;w++) GetPenNew(msg->gpr_GInfo->gi_Screen,&inst->Colors[w],w,inst->PorC,inst->Pens);
  403.  
  404.             SetDrMd(rp,JAM1);
  405.             SetFont(rp,inst->textFont);
  406.  
  407.             inst->text_y=((g->Height-((inst->textFont->tf_Baseline+inst->textFont->tf_YSize)>>1))>>1);
  408.             if(inst->textFont->tf_Baseline<inst->textFont->tf_YSize)
  409.             {
  410.                 inst->text_y+=inst->textFont->tf_Baseline-1;
  411.                 if(inst->text_y<inst->textFont->tf_Baseline)inst->text_y=inst->textFont->tf_Baseline;
  412.             }
  413.             else
  414.             {
  415.                 inst->text_y+=inst->textFont->tf_YSize-1;
  416.                 if(inst->text_y<inst->textFont->tf_YSize)   inst->text_y=inst->textFont->tf_YSize;
  417.             }
  418.             SetAPen(rp,inst->Pens[col_bg]);
  419.             if(inst->StyleBackground) my_RectFill(rp,g->LeftEdge,g->TopEdge,g->Width,g->Height);
  420.             if(inst->img)
  421.             {
  422.                 UWORD y,height,ypos;
  423.                 GetDTAttrs(inst->img,PDTA_BitMapHeader,&bmhd,TAG_DONE);
  424.                 if(bmhd->bmh_Height>(g->Height-6))
  425.                 {
  426.                 height=(g->Height-6);
  427.                 y=(bmhd->bmh_Height-height)>>1;
  428.                 ypos=3;
  429.                 }
  430.                 else
  431.                 {
  432.                 height=bmhd->bmh_Height;
  433.                 y=0;
  434.                 ypos=(g->Height/2)-(height/2);
  435.                 }
  436.                 DrawDTObject(inst->img,0,y,rp,g->LeftEdge+4,g->TopEdge+ypos,-1,height,inst->StyleTransparent);
  437.             }
  438.             if(inst->StyleBorder)
  439.             {
  440.                 if(inst->Style3D)
  441.                 {
  442.                 draw_border_new(rp,g->LeftEdge,g->TopEdge,g->Width,g->Height,inst->Pens[col_dark],inst->Pens[col_dark]);
  443.                 if(g->Flags & GFLG_SELECTED)draw_border_new(rp,g->LeftEdge+1,g->TopEdge+1,g->Width-2,g->Height-2,inst->Pens[col_hdark],inst->Pens[col_bright]);
  444.                 else                        draw_border_new(rp,g->LeftEdge+1,g->TopEdge+1,g->Width-2,g->Height-2,inst->Pens[col_bright],inst->Pens[col_hdark]);
  445.                 }
  446.                 else
  447.                 {
  448.                 if(g->Flags & GFLG_SELECTED)draw_border_new(rp,g->LeftEdge,g->TopEdge,g->Width,g->Height,inst->Pens[col_hdark],inst->Pens[col_bright]);
  449.                 else                        draw_border_new(rp,g->LeftEdge,g->TopEdge,g->Width,g->Height,inst->Pens[col_bright],inst->Pens[col_hdark]);
  450.                 }
  451.             }
  452.             t_length=TextLength(rp,inst->txtlbl,my_strlen(inst->txtlbl));
  453.             if(t_length<(g->Width - ((inst->indent==lind_left)||(inst->indent==lind_center) ? ( bmhd ? bmhd->bmh_Width : 0 )  : 0)))
  454.             {
  455.                 switch(inst->indent)
  456.                 {
  457.                 case    lind_center:
  458.                     if(bmhd) text_x=bmhd->bmh_Width+((g->Width-t_length-bmhd->bmh_Width)>>1);
  459.                     else     text_x=((g->Width-t_length)>>1);
  460.                     break;
  461.                 case    lind_left:
  462.                     if(bmhd) text_x=bmhd->bmh_Width+11;
  463.                     else     text_x=5;
  464.                     break;
  465.                 case    lind_right:
  466.                     text_x=g->Width-t_length-5;
  467.                     break;
  468.                 default :
  469.                     text_x=((g->Width-t_length)>>1);
  470.                     break;
  471.                 }
  472.                 if(inst->StyleShadowLabel)
  473.                 {
  474.                 SetAPen(rp,inst->Pens[col_dark]);
  475.                 Move(rp,text_x+g->LeftEdge+1,inst->text_y+g->TopEdge+1);
  476.                 Text(rp,inst->txtlbl,my_strlen(inst->txtlbl));
  477.                 }
  478.                 if(g->Flags & GFLG_SELECTED)
  479.                 {
  480.                 Move(rp,text_x+g->LeftEdge+1,inst->text_y+g->TopEdge+1);
  481.                 }
  482.                 else
  483.                 {
  484.                 Move(rp,text_x+g->LeftEdge,inst->text_y+g->TopEdge);
  485.                 }
  486.                 SetAPen(rp,inst->Pens[col_label]);
  487.                 Text(rp,inst->txtlbl,my_strlen(inst->txtlbl));
  488.             }
  489.             }
  490.             break;
  491.         case    typ_iconlauncher:
  492.             {
  493.             struct  lau_entry       *foobar;
  494.             ULONG                   fullness=0;
  495.             if(foobar=inst->list)
  496.             {
  497.                 do
  498.                 {
  499.                 if(foobar->img)
  500.                 {
  501.                     GetDTAttrs(foobar->img,PDTA_BitMapHeader,&bmhd,TAG_DONE);
  502.                     if(bmhd)
  503.                     {
  504.                     if((fullness+bmhd->bmh_Width)>g->Width) break;
  505.                     fullness+=bmhd->bmh_Width;
  506.                     }
  507.                 }
  508.                 }
  509.                 while(foobar=foobar->next);
  510.                 switch (inst->indent)
  511.                 {
  512.                 case    lind_right:
  513.                     inst->x_pos=g->Width-fullness;
  514.                     break;
  515.                 case    lind_left:
  516.                     inst->x_pos=0;
  517.                     break;
  518.                 case    lind_center:
  519.                 default:
  520.                     inst->x_pos=(g->Width-fullness)>>1;
  521.                     break;
  522.                 }
  523.                 foobar=inst->list;
  524.                 fullness=0;
  525.                 do
  526.                 {
  527.                 if(foobar->img)
  528.                 {
  529.                     GetDTAttrs(foobar->img,PDTA_BitMapHeader,&bmhd,TAG_DONE);
  530.                     if(bmhd)
  531.                     {
  532.                     if((fullness+bmhd->bmh_Width)>g->Width) break;;
  533.                     DrawDTObject(foobar->img,0,0,rp,g->LeftEdge+fullness+inst->x_pos,g->TopEdge+((g->Height-bmhd->bmh_Height)>>1),-1,-1,inst->StyleTransparent);
  534.                     fullness+=bmhd->bmh_Width;
  535.                     }
  536.                 }
  537.                 }
  538.                 while(foobar=foobar->next);
  539.             }
  540.             }
  541.             break;
  542.     }
  543.     inst->InitNotDone=FALSE;
  544.     if(msg->MethodID !=GM_RENDER) ReleaseGIRPort(rp);
  545.     return(TRUE);
  546.     }
  547.     return(FALSE);
  548. }
  549.